package com.lanchetech.common.enums;

import lombok.Getter;

@Getter
public enum WebsocketEventTypeEnum {
    CHAT_HISTORY("chatHistory", "获取聊天记录"),
    OPEN_CHAT("openChat", "打开聊天"),
    CHAT("chat", "向朋友发送消息"),
    CHAT_PAGE("chatPage", "获取聊天分页"),
    LOGIN("login", "登录"),
    USER_LOGIN("userLogin", "用户登录"),
    READ("read", "消息已读"),

    HEART_CHECK("chatHistory", "心跳检测"),
    ;

    private String type;
    private String remark;

    WebsocketEventTypeEnum(String type, String remark) {
        this.type = type;
        this.remark = remark;
    }

    public static WebsocketEventTypeEnum getByType(String type) {
        for (WebsocketEventTypeEnum item : WebsocketEventTypeEnum.values()) {
            if (item.getType().equals(type)) {
                return item;
            }
        }
        return CHAT_HISTORY;
    }
}
